package com.cloudbroker.openapi.mobile.controller;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.base.vo.HSBCPSVO;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.hsopen.result.OpenTokenBackForm;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.business.HsOpenT2BizService;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.viewpoint.BrokerT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;

@Controller
public class AmountController {

    @Resource
    private HsOpenT2BizService hsOpenT2;
    
    @Resource
    private BrokerT2BizService brokerT2;
    
    @ResponseBody
    @RequestMapping("/func_stock_task")
    @SaveLog(remark = "调用股票更新任务")
    public HSBCPSBackVO funcStockUploadTask(HttpServletRequest request , String jsonpcallback){
        HSBCPSVO form = getSingleParameterMapForBody(request , HSBCPSVO.class);
        return VOUtil.setJsonpResult(hsOpenT2.funcStockUploadTask(form), jsonpcallback);
    }

    @ResponseBody
    @RequestMapping("/func_open_token")
    @SaveLog(remark = "获取恒生开放平台AccessToken")
    public OpenTokenBackForm funcGetHsOpenToken(HttpServletRequest request , String jsonpcallback){
        HSBCPSVO form = getSingleParameterMapForBody(request , HSBCPSVO.class);
        return VOUtil.setJsonpResult(hsOpenT2.funcGetHsOpenToken(form), jsonpcallback);
    }
    
}
